﻿namespace System {

    public interface IReadOnlyBlockerData : IReadOnlyFusionData<bool>, IReadOnlyBoolData {
    }

    public interface IValueChangedBlockerData : IReadOnlyBlockerData, IValueChangedFusionData<bool>, IValueChangedBoolData {
    }

    public interface IBlockerData : IValueChangedBlockerData, IFusionData<bool> {
    }

    [Implement(typeof(IReadOnlyBlockerData))]
    [Implement(typeof(IValueChangedBlockerData))]
    [Implement(typeof(IBlockerData))]
    internal sealed class KHBD_BlockerData : KHBD_FusionData<bool>, IBlockerData {

        protected override bool GetDefaultValue() => true;

        protected override bool Calculate(bool current, bool next) {
            if (current && next) {
                return true;
            }
            return false;
        }

        protected override bool Clamp(bool value, bool min, bool max) {
            return value;
        }

        protected override bool GetDefaultMaxValue() {
            return true;
        }

        protected override bool GetDefaultMinValue() {
            return false;
        }
    }
}